normalise

Normalize a vector or matrix.

Contents

Syntax

Y = normalise(X)

Description

normalise(X) normalizes the values in the vector or matrix X to the range -1 to +1.

Example

X = randi([-10 10], 10, 1) % Column vector of 10 values in the range -10 to +10
Y = normalise(X)
X =

     4
   -10
    -5
   -10
    -8
     7
     4
    -4
     9
   -10


Y =

    0.4000
   -1.0000
   -0.5000
   -1.0000
   -0.8000
    0.7000
    0.4000
   -0.4000
    0.9000
   -1.0000

Input Arguments

X - the input vector or matrix of values (real, finite)

Output Arguments

Y - the normalized vector or matrix of values (real, finite)

Acknowledgement

This function is based on the normalization function provided by Steve Lord.

See Also

max | min | abs

Copyright: © 2015-2019 Pico Technology Ltd. All rights reserved.